package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper extends BaseMapper<Student> {
    List<Student> studentSelect(StudentQueryParam studentQueryParam);

    void studentDelete(@Param("ids") List<Integer> ids);

    @Insert("insert into student (name, no, gender, phone, id_card, is_college, address, degree, graduation_date, clazz_id, create_time, update_time) VALUES " +
            "(#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{createTime},#{updateTime})")
    void studentInsert(Student student);

    Student studentGetById(Integer id);

    void studentUpdate(Student student);

    void studentDisciplinary(@Param("id") Integer id, @Param("score") Integer score);

    List<Map> getStudentCountData();

    List<Map> getStudentDegreeData();

    @Select("select * from student where clazz_id = #{id}")
    List<Student> studentGetByClazzId(Integer id);
}
